#ifndef MYBUTTON_H
#define MYBUTTON_H

#include <QWidget>
#include<QPushButton>
#include<QMouseEvent>
#include<QEvent>
#include<QPainter>

class MyButton : public QPushButton
{
    Q_OBJECT
public:
    explicit MyButton(QWidget *parent = nullptr);

    //设置图像:点击,悬浮,离开
    void setImage(const QString&normal,const QString&hover,const QString&press);

protected:
    //重写事件
    void mousePressEvent(QMouseEvent*e)override;
    void enterEvent(QEvent *e) override;
    void leaveEvent(QEvent*e)override;
    void mouseReleaseEvent(QMouseEvent*e)override;
   //重绘事件
    void paintEvent(QPaintEvent *e) override;
signals:
    void betPoint(int point);
private:
    QString m_normal;
    QString m_hover;
    QString m_press;
    QPixmap p;
};

#endif // MYBUTTON_H
